<?php
namespace PAT\UserBundle\Entity;

use FOS\UserBundle\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="patuser")
 */

class User extends BaseUser
{
	/**
	 * @ORM\Id
	 * @ORM\Column(type="integer")
	 * @ORM\GeneratedValue(strategy="AUTO")
	 */
	protected $id;
	
	/**
	 * @ORM\Column(type="string", length=50, nullable = true)
	 * 
	 */
	protected $name;
	
	/**
	 * @ORM\Column(type="string", length=50, nullable = true)
	 *
	 */
	protected $firstname;
	
	/**
	 * @ORM\Column(type="string", length=20, nullable = true)
	 *
	 */
	protected $telephone;
	
	/**
	 * @ORM\OneToMany(targetEntity="PAT\UserBundle\Entity\Address", mappedBy="user",cascade={"persist"})
	 */
	protected $addresses;
	
	/**
	 * @ORM\OneToMany(targetEntity="PAT\WishlistBundle\Entity\Wishlist", mappedBy="user")
	 */
	protected $wishlists;
	
	/**
	 * @ORM\OneToMany(targetEntity="PAT\CommentBundle\Entity\Comment", mappedBy="user")
	 */
	protected $comments;
	
	/**
	 * @ORM\OneToMany(targetEntity="PAT\CartBundle\Entity\Command", mappedBy="user")
	 */
	protected $commands;
	
	/**
	 * 
	 * @ORM\ManyToMany(targetEntity="PAT\UserBundle\Entity\Reduction")
	 */
	protected $reductions;
    
    /**
     * Constructor
     */
    public function __construct()
    {
        parent::__construct();
    	$this->addresses = new \Doctrine\Common\Collections\ArrayCollection();
        $this->comments = new \Doctrine\Common\Collections\ArrayCollection();
        $this->commands = new \Doctrine\Common\Collections\ArrayCollection();
        $this->reductions = new \Doctrine\Common\Collections\ArrayCollection();
    }
    
    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return User
     */
    public function setName($name)
    {
        $this->name = $name;
    
        return $this;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set firstname
     *
     * @param string $firstname
     * @return User
     */
    public function setFirstname($firstname)
    {
        $this->firstname = $firstname;
    
        return $this;
    }

    /**
     * Get firstname
     *
     * @return string 
     */
    public function getFirstname()
    {
        return $this->firstname;
    }

    /**
     * Set telephone
     *
     * @param string $telephone
     * @return User
     */
    public function setTelephone($telephone)
    {
        $this->telephone = $telephone;
    
        return $this;
    }

    /**
     * Get telephone
     *
     * @return string 
     */
    public function getTelephone()
    {
        return $this->telephone;
    }

    /**
     * Add addresses
     *
     * @param PAT\UserBundle\Entity\Address $addresses
     * @return User
     */
    public function addAddresse(\PAT\UserBundle\Entity\Address $addresses)
    {
        $this->addresses[] = $addresses;
    	$addresses->setUser($this);
        return $this;
    }
    

    /**
     * Remove addresses
     *
     * @param PAT\UserBundle\Entity\Address $addresses
     */
    public function removeAddresse(\PAT\UserBundle\Entity\Address $addresses)
    {
        $this->addresses->removeElement($addresses);
    }

    /**
     * Get addresses
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getAddresses()
    {
        return $this->addresses;
    }

    /**
     * Add comments
     *
     * @param PAT\CommentBundle\Entity\Comment $comments
     * @return User
     */
    public function addComment(\PAT\CommentBundle\Entity\Comment $comments)
    {
        $this->comments[] = $comments;
    
        return $this;
    }

    /**
     * Remove comments
     *
     * @param PAT\CommentBundle\Entity\Comment $comments
     */
    public function removeComment(\PAT\CommentBundle\Entity\Comment $comments)
    {
        $this->comments->removeElement($comments);
    }

    /**
     * Get comments
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getComments()
    {
        return $this->comments;
    }

    /**
     * Add commands
     *
     * @param PAT\CartBundle\Entity\Command $commands
     * @return User
     */
    public function addCommand(\PAT\CartBundle\Entity\Command $commands)
    {
        $this->commands[] = $commands;
    
        return $this;
    }

    /**
     * Remove commands
     *
     * @param PAT\CartBundle\Entity\Command $commands
     */
    public function removeCommand(\PAT\CartBundle\Entity\Command $commands)
    {
        $this->commands->removeElement($commands);
    }

    /**
     * Get commands
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getCommands()
    {
        return $this->commands;
    }

    /**
     * Add wishlists
     *
     * @param PAT\WishlistBundle\Entity\Wishlist $wishlists
     * @return User
     */
    public function addWishlist(\PAT\WishlistBundle\Entity\Wishlist $wishlists)
    {
        $this->wishlists[] = $wishlists;
        $wishlists->setUser($this);
        return $this;
    }

    /**
     * Remove wishlists
     *
     * @param PAT\WishlistBundle\Entity\Wishlist $wishlists
     */
    public function removeWishlist(\PAT\WishlistBundle\Entity\Wishlist $wishlists)
    {
        $this->wishlists->removeElement($wishlists);
    }

    /**
     * Get wishlists
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getWishlists()
    {
        return $this->wishlists;
    }

    /**
     * Add reductions
     *
     * @param PAT\UserBundle\Entity\Reduction $reductions
     * @return User
     */
    public function addReduction(\PAT\UserBundle\Entity\Reduction $reductions)
    {
        $this->reductions[] = $reductions;
    
        return $this;
    }

    /**
     * Remove reductions
     *
     * @param PAT\UserBundle\Entity\Reduction $reductions
     */
    public function removeReduction(\PAT\UserBundle\Entity\Reduction $reductions)
    {
        $this->reductions->removeElement($reductions);
    }

    /**
     * Get reductions
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getReductions()
    {
        return $this->reductions;
    }
    
    public function getCart()
    {
        return $this->cart;
    }
    
   public function setCart($cart)
   {
       $this->cart = $cart;
       return $this;
   }
}